<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>大区销售目标预测</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <link rel="stylesheet" href="/dist/plugins/fixedTable/fixed-table.css"/>
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .table > tbody > tr > td {
            height: 30px;
            max-height: 44px;
            overflow: hidden;
            padding: 0 2px;
            border: 1px #cbcbcd solid
        }

        .table > thead > tr > th {
            border: 1px #cbcbcd solid
        }

        tbody {
            font-size: 12px;
        }

        .saveModle {
            width: 500px;
            height: 300px;
            position: fixed;
            top: 50%;
            left: 50%;
            margin-left: -250px;
            margin-top: -150px;
            background: #fff;
            border-radius: 10px;
            z-index: 1978;
            display: none;
            border: 1px solid #cfcfcf;
        }

        .saveModle .top {
            height: 34px;
            line-height: 34px;
            font-size: 14px;
            font-weight: bold;
            color: #333;
            padding-left: 7px;
            border-bottom: 1px solid #cfcfcf;
            background: #fff;
        }

        .saveModle .top .title {
            height: 32px;
            line-height: 32px;
            font-size: 14px;
            font-weight: bold;
            color: #333;
            float: left;
            background: #fff;
        }

        .saveModle .top .btn {
            font-size: 20px;
            width: 34px;
            height: 22px;
            line-height: 12px;
            display: inline-block;
            float: right;
        }

        .saveModle .top .btn:hover {
            color: red;
        }

        .saveModle .saveBtn {
            margin: 0 auto;
            margin-top: 35px;
            display: block;

        }

        .lineOne {
            max-height: 36px;
            line-height: 18px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
        }

        p {
            display: inline-block;
            float: left;
            margin-bottom: 0px;
            line-height: 25px;
            padding-right: 15px;
            color: #228bee;
            font-size: 14px;
        }

        .td-value span.lineOne {
            overflow: hidden;
            text-overflow: ellipsis;
            color: black !important;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            max-height: 48px;
            line-height: 24px;
        }

        .td-value span.lineOne1 {
            overflow: hidden;
            text-overflow: ellipsis;
            color: black !important;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            max-height: 48px;
            line-height: 24px;
        }

        .td-value {
            text-align: left !important;
            vertical-align: middle;
            word-wrap: break-word;
            color: black !important;
        }

        .td-value span {
            display: inline-block;
            overflow: hidden;
            padding-left: 0.06rem;
            word-wrap: break-word;
            color: black !important;
        }

        .fixed-table_body tr td {
            border-right: none;
        }

        .fixed-table_header tr th {
            border-right: none;
            background: yellow;
            font-weight: normal;
            font-size: 12px;
        }

        .input-sm {
            height: 24px;
            padding: 5px 10px;
            font-size: 12px;
            line-height: 24px;
            border-radius: 0px;
        }

        .description {
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-start;
            width: 260px;
            /* margin-left: 395px; */
            /* padding-top: 50px; */
            /* float: right; */
            position: absolute;
            top: -10px;
            right: 0px;
            background: #d3e8fd;
            padding: 5px;
            z-index: 1111;
            border: 1px solid #cbcbcd;
        }

        .mubiao {
            display: block;
            /* justify-content: flex-start; */
            /* position: absolute; */
            /* top: 60px; */
            /* right: 255px; */
            margin: 15px auto;
            height: 60px;
            width: 350px
        }

        .title {
            background: rgb(211, 232, 253) !important;;
        }

        .lineOne span, .lineSpan {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
        }

        .text-center td {
            background: #fff;
        }

        /*获取公司*/

        .content {
            padding: 0px 0px 15px 20px;
            padding-bottom: 0;
        }

        #tbList tr td {
            height: 42px !important;
        }

        .fixed-table-box td {
            position: static;
        }

        html, body, #app {
            padding: 0px;
            margin: 0px;
        }

        .fixed-table-box th {
            position: relative;
            text-align: center;
            height: 24px;
            border: 1px solid #cbcbcd;
        }

        .fixed-table-box th {

        }

        .companyMore {
            width: 100%;
            height: 65px;
            position: relative;
            margin-top: 82px;
        }

        .companyOne {
            width: 100%;
            height: 65px;
            position: relative;
            margin-top: 65px;
        }

        .table {
            width: 100%;
            max-width: 100%;
            margin-bottom: 0px;
        }

        .has-feedback .form-control {
            padding-right: 0px;
        }

        .duiqi {
            text-align: justify;
            display: inline-block;
            overflow: hidden;
            vertical-align: middle;
            height: 36px;
            line-height: 24px;
            width: 36px;
        }

        /*获取区域总监*/
        .tabActive {
            text-align: center;
            color: #228bee;
            /*border-bottom: 2px solid #228bee;*/
            margin-left: 8px;
            margin-right: 8px;
            height: 24px;
            line-height: 24px;
        }

        .tabNo {
            text-align: center;
            color: #666666;
            font-size: 12px;
            /*border-bottom: 2px solid #f8f8f8;*/
            margin-left: 8px;
            margin-right: 8px;
            height: 24px;
            line-height: 24px;
        }

        .oa-tab-small {
            display: -webkit-box;
            position: fixed;
            top: 40px;
            overflow-y: hidden;
            -webkit-overflow-scrolling: touch;
            height: 30px;
            width: 100%;
            background: #fff;
            z-index: 1111;
            display: flex;
        }

        .wyTd {
            height: 18px !important;
        }

        .fixed-table_body tr td {
            border-right: none;
            font-size: 12px;
            text-align: center;
            height: 24px;
            max-height: 24px;
            overflow: visible;
        }

        .div-td-actual-value tr td, .div-td-content-exam tr td {
            height: 29px;
            line-height: 29px;

        }

        .div-td-actual-value .td-title, .div-td-content-exam .td-title {
            color: #333;
        }

        .div-td-actual-value .td-title, .div-td-content-exam tr:nth-of-type(odd) {
            background: #fff !important;
        }

        .div-td-actual-value .td-title, .div-td-content-exam .table-detail td {
            border-right: 1px solid #e8e8e9;
            border-bottom: 1px solid #e8e8e9;
            padding-left: 0px !important;
            padding-right: 0px !important;
            padding-top: 0px !important;
            padding-bottom: 0px !important;
            height: 29px;
            line-height: 29px;
            text-align: center;
            position: relative;
        }

        .div-td-content-exam {
            position: absolute;
            height: auto;
            z-index: 999;
            left: -190px;
            top: 24px;
            width: 250px;
            line-height: 20px;
            background: #fff;
            border: 1px solid #e8e8ea;
            min-height: 80px;
        }

        .div-td-content-exam i {
            width: 15px;
            height: 12px;
            background: url(/dist/img/more-icon.png);
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .div-td-actual-value i {
            width: 15px;
            height: 12px;
            background: url(/dist/img/more-icon.png);
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .div-td-actual-value {
            position: absolute;
            height: auto;
            z-index: 999;
            left: -190px;
            top: 24px;
            width: 250px;
            line-height: 20px;
            background: #fff;
            border: 1px solid #e8e8ea;
            min-height: 80px;
        }

        body {
            overflow-y: hidden;
        }
    </style>
</head>
<body>
<section class="content " style="padding-left:0px;" id="app" v-cloak>
    <div class="oaLoad">
        <div class="loadGif" id="areaProgress"></div>
    </div>
    <div class="div-td-content-more"><i></i></div>
    <iframe id="ifExprot" style="width:0px;height:0px;display: none;" frameborder="0"></iframe>
    <div style="height: 25px;margin-bottom: 10px;margin-top: 50px;">
        <div class="pull-left" style="width: 127px;">
            <select id="selectCostName" class="form-control"
                    style="height: 24px;font-size: 12px;line-height: 24px;padding-top: 0px;padding-bottom: 0px;padding-left: 6px;"
                    v-model="searchParams.selectCost">
                <option value="">请选择费用名称</option>
                <option v-for="item in costList" v-bind:value="item.costSmallName">{{item.costSmallName}}</option>
            </select>
        </div>
        <input class="pull-left form-control pull-left input-sm" type="text" v-model="searchParams.beginTime"
               @focus="showDatePicker($event)" placeholder="请选择开始时间" style="width: 106px;margin-left: 10px;">
        <input class="pull-left form-control pull-left input-sm" type="text" v-model="searchParams.endTime"
               @focus="endDatePicker($event)" placeholder="请选择结束时间" style="width: 106px;margin-left: 10px;">
        <button type="button" class="btn oaBtn btn-sm pull-left" style="margin-left: 10px;" @click="getList">查询</button>
        <!--<button type="button" class="btn oaBtn btn-sm pull-left" style="margin-left: 10px;" @click="removeSelect">清空-->
        <!--</button>-->
    <!--</div>-->
    <!--<div style="height: 25px;margin-bottom: 10px;">-->
        <button type="button" class="btn oaBtn btn-sm pull-left" style="margin-left: 10px;" @click="getCost()">申请报销</button>
        <button type="button" class="btn oaBtn btn-sm pull-left" style="margin-left: 10px;" @click="getDelete">作废
        </button>
        <div style=" margin-top: 5px;width: 200px;float:left; margin-left: 12px;">
            报销金额合计(元)： <span style="color: red">{{checkMoney==0?'0.00':checkMoney}}</span>
        </div>
    </div>
    <div class="box-body no-padding iframeH4" id="scrollDiv">
        <div id="progress" class="wyui-progress"></div>
        <div class="fixed-table-box head-fixed " style="height: 100%">
            <div class="fixed-table_header-wraper">
                <table class="fixed-table_header" cellspacing="0" cellpadding="0" border="0">
                    <!--<table class="table table-hover  text-center" style="margin-top: 20px;">-->
                    <thead>
                    <tr>
                        <th style="width:30px;">
                            <input type="checkbox" id="checkAll" v-model="isCheckedAll" style=" margin-top: 6px;"/>
                        </th>
                        <th style="width:40px;">
                            <div class="table-cells">序号</div>
                        </th>
                        <th style="width:60px">
                            <div class="table-cells">姓名</div>
                        </th>
                        <th style="width:60px">
                            <div class="table-cells">日期</div>
                        </th>
                        <th style="width:90px">
                            <div class="table-cells">费用名称</div>
                        </th>
                        <th style="width:60px">
                            <div class="table-cells">金额(元)</div>
                        </th>
                        <th style="width:75px">
                            <div class="table-cells">是否有发票</div>
                        </th>
                        <th style="width:75px">
                            <div class="table-cells">抵票金额(元)</div>
                        </th>
                        <th style="width:60px">
                            <div class="table-cells">抵票情况</div>
                        </th>
                        <th style="width:75px">
                            <div class="table-cells">实际报销(元)</div>
                        </th>
                        <th>
                            <div class="table-cells">备注</div>
                        </th>
                        <th style="width:120px">
                            <div class="table-cells">操作</div>
                        </th>
                        <th id="tdMore">
                            <div class="table-cells"></div>
                        </th>
                    </tr>
                    </thead>
                </table>
            </div>
            <div class="fixed-table_body-wraper iframeYKFixed" id="divMain" style="height: 100%">
                <table class="fixed-table_body table-hover" id="tableMain" cellspacing="0" cellpadding="0" border="0"
                       style="width: 100%;">
                    <tbody>
                    <tr v-for="(item,i) in list">
                        <td style="width:30px;"><input type="checkbox" @click="checked(item)"
                                                       :checked="isArray(item.id)" enabled="isEnable(item)"
                                                       v-model="item.checked"/></td>


                        <td style="width:40px;"><span>{{i+1}}</span></td>
                        <td style="width:60px;"><span class="oa-name">{{item.userName}}</span></td>
                        <td style="width:60px;"><span>{{formatDate((item.reportDate))}}</span></td>
                        <td style="width:90px;"><span>{{item.costSmallName}}</span></td>
                        <td style="width:60px;"><span>{{item.money}}</span></td>
                        <td style="width:75px;"><span>{{item.invoiceFlag=="1"?"有":"无"}}</span></td>
                        <td style="width: 75px">
                            <span>{{item.rushMoney=='0'?'':item.rushMoney}}</span>
                        </td>
                        <td style="width: 60px;position: relative">
                                    <span v-if="item.bxState=='0'&&item.invoiceFlag!='1'" :attr-type="item.id"
                                          attr-pagetype="edit"
                                          style="color: #2a8cec !important;cursor: pointer;text-align: center"
                                          @click="showDiv(item,'edit')"
                                          class="td-value changeValue">编辑</span>
                            <span v-if="item.invoiceFlag!='1'&&item.bxState!='0'" :attr-type="item.id"
                                  attr-pagetype="look"
                                  style="color: #2a8cec !important;cursor: pointer;text-align: center"
                                  @click="showDiv(item,'look')"
                                  class="td-value changeValue">查看</span>
                            <div class="div-td-content-exam" v-if="item.show==true">
                                <table class="table-detail">
                                    <tbody>
                                    <tr class="no-print">
                                        <td colspan="2" class=" no-print td-module">
                                            抵票信息
                                            <div class="ui_title_buttons" style="top: 0px;">
                                                <a class="ui_close" id="esc" href="javascript:void(0);" title="关闭(esc键)"
                                                   @click="hideDiv(item)"
                                                   style="display: inline-block;">×</a>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="td-title" style="background-color: #f5f5f5;">抵票名称</td>
                                        <td class="td-title" style="background-color: #f5f5f5;">金额(元)</td>
                                    </tr>
                                    <tr v-for="(item2,i2) in rushMoneyList">
                                        <td style="text-align: center !important;color: #2a8cec">
                                            <select v-if="rushPageType=='edit'" v-model="item2.costSmallId"
                                                    @change="changeCostName(item2,i2)">
                                                <option value="">请选择</option>
                                                <option v-for="expense in expensesList" v-bind:value="expense.id">
                                                    {{expense.name}}
                                            </select>
                                            <span v-else style="text-align: center"> {{item2.costSmallName}}</span>
                                        </td>
                                        <td
                                            style="width: 145px;color: #2a8cec;text-align: center !important;">
                                            <input v-if="rushPageType=='edit'" class="payeeName" type="text"
                                                   v-model="item2.rushOffMoney">
                                            <span v-else> {{item2.rushOffMoney}}</span>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                <div v-if="rushPageType=='edit'" class="south no-print"
                                     style="height: 50px; line-height: 50px; text-align: center;margin-top: -12px;">
                                    <input type="button" value="保存" class="btn oaBtn btn-sm" @click="saveCost(item.id)">
                                </div>
                            </div>
                        </td>

                        <td style="width: 75px;position: relative">
                                    <span :attr-type="item.id" attr-pagetype="edit"
                                          @click="showDivActual(item,'edit')"
                                          style="color: #2a8cec !important;cursor: pointer;text-align: center"
                                          class="td-value changeActualValue">{{item.actualBxMoney?item.actualBxMoney:'编辑'}}</span>
<!--                            <span v-if="item.bxState!='0'" :attr-type="item.id" attr-pagetype="look"-->
<!--                                  @click="showDivActual(item,'look')"-->
<!--                                  style="color: #2a8cec !important;cursor: pointer;text-align: center"-->
<!--                                  class="td-value changeActualValue">-->

<!--                                        {{item.actualBxMoney?(item.costSmallName=='油卡加油费'?'0':item.actualBxMoney):(currentUser.roleName=='区域支持'?'查看':'')}}-->
<!--                                    </span>-->
                            <div class="div-td-actual-value" v-if="item.showActual==true">
                                <table class="table-detail">
                                    <tbody>
                                    <tr class="no-print">
                                        <td colspan="2" class=" no-print td-module">
                                            实际报销
                                            <div class="ui_title_buttons" style="top: 0px;">
                                                <a class="ui_close" id="actualEsc" href="javascript:void(0);"
                                                   title="关闭(esc键)" @click="hideDivActual(item)"
                                                   style="display: inline-block;">×</a>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                <table class="table-detail">
                                    <tbody>
                                    <tr>
                                        <td class="td-title" style="background-color: #f5f5f5 !important;width: 100px">
                                            报销金额(元)
                                        </td>
                                        <td class="td-title" style="background-color: #f5f5f5 !important;">说明</td>
                                    </tr>
                                    <tr>
                                        <td class="td-tanZongStyle-line" style="border-right: 1px solid #e8e8e9">
                                            <input v-if="rushPageType=='edit'" class="payeeName"
                                                   style="text-align: center;color: #2a8cec" type="text"
                                                   v-model="costEntity.actualBxMoney"
                                            >
                                            <span v-else class="lineOne" style="color: #2a8cec">{{costEntity.actualBxMoney=='0'?'':costEntity.actualBxMoney}}</span>
                                        </td>
                                        <td class="td-row3" style="color: #2a8cec">
                                            <textarea v-if="rushPageType=='edit'"
                                                      v-model="costEntity.actualBxCondition"></textarea>
                                            <span v-else class="lineOne">{{costEntity.actualBxCondition}}</span>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                <div v-if="rushPageType=='edit'" class="south no-print"
                                     style="height: 50px; line-height: 50px; text-align: center;margin-top: -12px;">
                                    <input type="button" value="保存" class="btn oaBtn btn-sm"
                                           @click="saveActualRushCost(item.id)">
                                </div>
                            </div>
                            <!--<input type="hidden" v-model="item.id">-->
                            <!--<input v-if="item.auditFlag" type="button" align="center"-->
                            <!--style="background-color: white;border: 0px;color: blue"-->
                            <!--@click="gotoDetail  (item.id)" value="查看费用详情">-->
                        </td>
                        <td style="text-decoration: none;text-align:left" class='td-tanZongStyle-line'><i></i><span
                                class="lineOne">{{item.remark}}</span></td>
                        <td style="width: 120px">
                            <a href="javascript:void(0);" @click="gotoDetail(item,'look')"
                               style="color:#2a8cec;cursor: pointer;text-align: center">查看</a>
                            <!--<input type="hidden" v-model="item.id">-->
                            <!--<input v-if="item.auditFlag" type="button" align="center"-->
                            <!--style="background-color: white;border: 0px;color: blue"-->
                            <!--@click="gotoDetail(item.id)" value="查看费用详情">-->
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="oa-pager text-center" style="margin-top: 5px;">
            共
            <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
            <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
            <span class="oa-pager-button" id="first">首页</span>
            <span class="oa-pager-button" id="prev">上一页</span>
            <span class="oa-pager-button" id="next">下一页</span>
            <span class="oa-pager-button" id="last">尾页</span>
        </div>
        <!-- /.box-body -->
    </div>

</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script src="/dist/plugins/fixedTable/fixed-table.js"></script>
<script src="/dist/js/pages/wreport/Template.js?t=42e28def"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne,.lineTwo", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + 12 + "px",
                        "left": $(this).offset().left - 6,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    function refresh() {
        $.wyui.page.getByPage();
    }

    var app = new Vue({
        el: '#app',
        data: {
            selectIds: [],
            selectIndex: '待审核',
            searchParams: {
                selectCom: "",
                selectCost: "",
                beginTime: "",
                endTime: "",
                userName: "",
                costSmallName: "",
                userId: getCurrentUser().id,
                currentUserId: getCurrentUser().id,
                type: "",
                load: true
            },
            companyList: [],
            costList: [],
            expensesList: [],
            list: [],
            rightOp: [],
            isCheckedAll: false,
            costEntity: {
                actualBxCondition: "",
                actualBxMoney: ""
            },
            rushPageType: 'edit',
            showActual: false,
            rushMoneyList: [
                new Template.rushList()
            ],
            checkMoney: 0.00,
        },
        methods: {
            getList: function () {
                var that = this;
                this.selectIds=[];
                this.isCheckedAll=false;
                $.wyui.page.queryParams.requestPage = 1;
                if (that.searchParams.userName == "") {
                    that.searchParams.userId = ""
                }
                var data = {
                    'companyId': that.searchParams.selectCom,
                    'beginTime': that.searchParams.beginTime,
                    'endTime': that.searchParams.endTime,
                    'userName': that.searchParams.userName,
                    'costSmallId': that.searchParams.selectCost,
                    'costSmallName': that.searchParams.selectCost,
                    'userId': that.searchParams.userId,
                    'currentUserId': that.searchParams.currentUserId,
                    'load':true
                };
                    /*  $.extend($.wyui.page.queryParams, that.searchParams);*/
                $.extend($.wyui.page.queryParams, data);
                console.log($.wyui.page.queryParams);
                $.wyui.page.getByPage();
            },
            removeSelect: function () {
                var that = this;
                that.searchParams.beginTime = "",
                    that.searchParams.endTime = "",
                    that.searchParams.costSmallName = "",
                that.searchParams.selectCost=""
            },
            //日期格式
            formatDate: function (now) {
//                return  NewDate(now).Format(TimeFormat.middle)
                return new Date(now).Format(TimeFormat.pcListYR);
            },
            isArray: function (id) {
                var that = this;
                if ($.inArray(id, that.selectIds) > -1) {
                    // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                    return true;
                } else {
                    // 选中该checkbox
                    return false;
                }
            },
            showDatePicker: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.searchParams.beginTime = dp.cal.getNewDateStr();
                        return true;
                    },
                    //dateFmt:'yyyy-MM-dd HH:mm'
                });
                $(e.target).blur();
            },
            endDatePicker: function (e) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.searchParams.endTime = dp.cal.getNewDateStr();
                        return true;
                    },
                });
                $(e.target).blur();
            },
            showDivActual: function (item, rushPageType) {
                var type = $(this).attr("attr-type");
                var that = this;
                that.rushPageType = rushPageType;
                that.getCostActualRush(item.id);
                for (var i = 0; i < that.list.length; i++) {
                    that.list[i].showActual = false;
                    that.list[i].show = false;
                }
                item.showActual = true;
            },
            //弹出抵票表格
            showDiv: function (item, rushPageType) {
                var that = this;
                that.rushPageType = rushPageType;
                that.getCostRushList(item.id);
                for (var i = 0; i < that.list.length; i++) {
                    that.list[i].show = false;
                    that.list[i].showActual = false;
                }
                item.show = true;
            },
            getCostActualRush: function (id) {
                var that = this;
                $.wyui.postLoadMethod(urlConfig.wreport.wreportCost.getCostById, {fkCostId: id}, function (r) {
                    console.log(r);
                    that.costEntity = r.costEntity;
                    if (that.costEntity.actualBxMoney == '0') {
                        that.costEntity.actualBxMoney = ''
                    }

                }, false, false);
            },
            getCostRushList: function (id) {
                var that = this;
                $.wyui.postLoadMethod(urlConfig.wreport.wreportCost.getCostRushByFkCostId, {fkCostId: id}, function (r) {
                    console.log(r);
                    that.rushMoneyList = r;
                    that.rushListSix();
                }, false, false);
            },
            rushListSix: function () {
                var that = this;
                for (var i = that.rushMoneyList.length; i < 6; i++) {
                    that.rushMoneyList.push(new Template.rushList())
                }
            },
            hideDiv: function (item) {
                console.log(item)
                item.show = false;
            },
            hideDivActual: function (item) {
                console.log(item)
                item.showActual = false;
            },
            //格式化钱
            keyDownMoney: function (AmtStr) {
                var amtReg = /^([1-9][\d]*|0)(\.[\d]{0,2})?$/;
                var orgStr = AmtStr.value;
                var amtStr = orgStr.replace(/,/g, "");
                if (!amtReg.test(amtStr)) {
                    if (amtStr == "") {
                        $("#" + hiddenId).val("");
                        obj.val("");
                        return;
                    }
                    amtStr = $("#" + hiddenId).val();


                }
                var dox = "";//小数位
                if (amtStr.indexOf(".") != -1) {
                    dox = amtStr.substring(amtStr.indexOf("."));
                    amtStr = amtStr.substring(0, amtStr.indexOf("."));
                }


                amtStr = this.add_Qfw(amtStr);
                console.log(amtStr + dox)
                AmtStr.value = amtStr + dox;
            },
            getCost: function (e) {
                var that = this;
                console.log(that.selectIds.length)
                console.log(that.selectIds);
                if (that.selectIds.length > 0) {
                    top.$.dialog({
                        content: 'url:/page/wreport/wreportCost/yiBaoXiaoDetail.html?ids=' + that.selectIds+'&type=1',
                        title: "报销明细",
                        width: 1100,
                        height: 365,
                        max: true,
                        min: true,
                        lock: true
                    });
                } else {
                    alert("请勾选要报销的费用")
                }
            },
            getDelete: function (e) {
                var that = this;
                if (that.selectIds.length > 0) {
                    $.wyui.postLoadMethod(urlConfig.wreport.wreportCost.config, {
                        costIds: that.selectIds.join(","),
                        start: -1
                    }, function (list) {
                        alert("修改成功");
                        that.getList();
                        that.selectIds = [];
                    }, false, false);
                } else {
                    alert("请勾选要作废报销的费用")
                }
            },
            gotoDetail: function (item,type) {
                if(item.type=='0'){
                    top.$.dialog({
                        content: 'url:/page/wreport/wreportCost/costDetail.html?id=' + item.id+'&pageType='+ type,
                        title: "费用详情",
                        width: 804,
                        height: 415,
                        max: true,
                        min: true,
                        lock: true
                    });
                }else{
                    top.$.dialog({
                        content: 'url:/page/wreport/temporaryExpenses.html?id=' + item.id+'&pageType='+ type,
                        title: "费用详情",
                        width: 804,
                        height: 365,
                        max: true,
                        min: true,
                        lock: true
                    });
                }
            },
            //保存t_wrt_cost表对象（实际报销）
            saveActualRushCost: function (id) {
                var that = this;
                $.wyui.postLoadMethod(urlConfig.wreport.wreportCost.saveOrUpdateCost, {
                    fkCostId: id,
                    cost: that.costEntity
                }, function (r) {
                    console.log(r);
                    if (that.searchParams.userName == ""&&that.searchParams.selectCom== ""&& that.searchParams.selectCost== ""&& that.searchParams.beginTime== ""&& that.searchParams.endTime== ""&& that.searchParams.costSmallName== "") {
                        that.searchParams.userId = getCurrentUser().id;
                        that.searchParams.userName = getCurrentUser().name;
                    }
                    that.getList()
                    $(".div-td-actual-value").hide();
                },false,false);

            },
            getHeight: function () {
                var allHeight = $("#divMain").height()
                var tableHeight = $("#tableMain").height()
                console.log(allHeight,tableHeight)
                var flag = allHeight >= tableHeight ? true : false
                console.log(flag)
                if (flag) {
                    $('#tdMore').css('width', '0px');
                } else {
                    $('#tdMore').css('width', '17px');
                }
            },
            //保存t_wrt_cost_rush表对象(抵票信息)
            saveCost: function (id) {
                var that = this;
                console.log(that.rushMoneyList)
                $.wyui.postLoadMethod(urlConfig.wreport.wreportCost.saveOrUpdateCostRush, {
                    fkCostId: id,
                    costPush: that.rushMoneyList
                }, function (r) {
                    console.log(r);
                    if (that.searchParams.userName == ""&&that.searchParams.selectCom== ""&& that.searchParams.selectCost== ""&& that.searchParams.beginTime== ""&& that.searchParams.endTime== ""&& that.searchParams.costSmallName== "") {
                        that.searchParams.userId = getCurrentUser().id;
                        that.searchParams.userName = getCurrentUser().name;
                    }

                    that.getList()
                    $(".div-td-content-exam").hide();
                },false,false);

            },
            changeCostName: function (item, idx) {
                console.log(item.costSmallId)
                var that = this;
                for (var i = 0; i < that.expensesList.length; i++) {
                    if (that.expensesList[i].id == item.costSmallId) {
                        that.rushMoneyList[idx].costSmallName = that.expensesList[i].name
                    }
                }
            },
            checked: function (item) {
                var that = this;
                if ($.inArray(item.id, that.selectIds) > -1) {
                    // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                    console.log(that.selectIds.length)
                    for (var i = 0; i < that.selectIds.length; i++) {
                        if (that.selectIds[i] == item.id) {
                            that.selectIds.splice(i, 1);
                            that.checkMoney=Number(that.checkMoney)-Number(item.money)
                        }
                    }
                } else {
                    // 选中该checkbox
                    that.selectIds.push(item.id)
                    that.checkMoney=Number(that.checkMoney)+Number(item.money)
                }
                this.checkMoney=this.checkMoney.toFixed(2)
            },
            isArray: function (id) {
                var that = this;
                if ($.inArray(id, that.selectIds) > -1) {
                    // 如果已经包含了该id, 则去除(单选按钮由选中变为非选中状态)
                    return true;
                } else {
                    // 选中该checkbox
                    return false;
                }
            },
        },
        watch: {
            isCheckedAll: function (isCheck) {
                if (isCheck) {
                    for (var i = 0; i < this.list.length; i++) {
                        var item = this.list[i];
                        //console.log("1111111111111111"+JSON.stringify(item))
                        if (item.bxState == 0) {
                            item.checked = this.isCheckedAll;
                            this.selectIds.push(item.id);
                            this.checkMoney = Number(this.checkMoney) + Number(item.money)
                        }
                    }

                } else {
                    this.selectIds = [];
                    for (var i = 0; i < this.list.length; i++) {
                        var item = this.list[i];
                        item.checked = this.isCheckedAll;

                    }
                    this.checkMoney = 0.00
                }
                this.checkMoney=this.checkMoney.toFixed(2)
            }
        },
        mounted: function () {
            var that = this;
            /* $.wyui.postMethod(urlConfig.system.company.getCompanyList, {}, function (r) {
             console.log(r);
             that.companyList=r;
             });*/
            $.wyui.postLoadMethod(urlConfig.system.company.getCompanyByUserId, {userId: getCurrentUser().id}, function (r) {
                console.log(r);
                that.companyList = r;
            }, false, false);

//            $.wyui.postLoadMethod(urlConfig.system.rightOp.getRightOpByUserId, {userId: getCurrentUser().id}, function (rightOp) {
//                for (var i = 0; i < rightOp.length; i++) {
//                    that.rightOp.push(rightOp[i].eName);
//                }
//                console.log("权限列表如下：")
//                console.log(that.rightOp);
//                //判断用户是否有添加人员的权限
//                if (!getCurrentUser().superUser && !that.isHasRightOp('addUser')) {
//                    $("#addUserBtn").hide();
//                } else {
//                    $("#addUserBtn").show();
//                }
//            }, false, false);

            $.wyui.postLoadMethod(urlConfig.wreport.wreportCost.getCostSmallNameList, {}, function (r) {
                console.log(r);
                that.costList = r;
            }, false, false);

            $.wyui.postLoadMethod(urlConfig.wreport.wreportCost.getAllExpensesType, {}, function (r) {
                console.log(r);
                that.expensesList = r;
            }, false, false);
        }

    })

</script>
<script>
    //初始化FixedTable
    $(".fixed-table-box").fixedTable();
</script>
<script>

    $.wyui.page.dataUrl = server.ip + "/wreportCost/getWaitBxByPage.json";
    $.wyui.page.queryParams.pageType = $.wyui.page.urlParams.pageType;
    $.wyui.page.queryParams = {
        requestPage: 1,
        pageSize: 100
    }
    $.extend($.wyui.page.queryParams, app.searchParams);
    $.wyui.page.getByPage_callback = function (records) {
        console.log(records)
        var H = $(window).height()
        $(".iframeYKFixed").css("maxHeight", H - 174);
        $(".iframeH4").height(H - 150);
        for (var i = 0; i < records.length; i++) {
            records[i].show = false;
            records[i].showActual = false;
        }
        app.list = records;
        setTimeout(function () {
            app.getHeight();
        },200)
        document.getElementById("scrollDiv").scrollTop = 0;
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                app.list.push(list[i]);
            }
            isLoad = true;
        }
    };
    //自动补全
    $(function () {

        $("#txtCoster").autoComplete({
            url: server.ip + urlConfig.system.user.getCosterTop10ByNameUserRight,
            render: function (users, panel) {
                console.log("users=" + users);
                if (users) {
                    for (var i = 0; i < users.length; i++) {
                        $("<li></li>").data("autoComplete",
                            users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                            "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                            .appendTo(panel);
                    }
                }
            },
            selected: function (user) {
                console.log(user);
                app.searchParams.userId = user.id;
                app.searchParams.userName = user.name;
            },
            extraParams: {userId: getCurrentUser().id},
            height: 210,
            width: 300
        });
    }),
        //自动补全
        $(function () {
                $("#txtCostSmallName").autoComplete({
                    url: server.ip + "/wreportCost/getCosterTop10ByCostName.json",
                    render: function (users, panel) {
                        console.log("users=" + users);
                        if (users) {
                            for (var i = 0; i < users.length; i++) {
                                $("<li></li>").data("autoComplete",
                                    users[i]).html("<a>" + users[i].costName + "</a>")
                                    .appendTo(panel);
                            }
                        }
                    },
                    selected: function (user) {
                        console.log(user);
                        app.searchParams.costSmallName = user.costName;
                    },
                    height: 210,
                    width: 300
                });
            },
            Vue.directive('line-inserted', {
                inserted: function (el, binding) {
                    console.log(el);
                    var lineIndex = binding.value;
                    renderLines(el, lineIndex);
                }
            })
        );
    function selectAll() {
        var isCheck = $("#sel_1").is(':checked');  //获得全选复选框是否选中
        $("input[type='checkbox']").each(function () {
            this.checked = isCheck;       //循环赋值给每个复选框是否选中
        });
    };
</script>
<script>
    /************************滚动加载******************************/
    var divscroll = document.getElementById('scrollDiv');

    function divScroll() {
        var wholeHeight = divscroll.scrollHeight;
        var scrollTop = divscroll.scrollTop;
        var divHeight = divscroll.clientHeight;
        console.log(scrollTop + divHeight, wholeHeight)
        if (scrollTop + divHeight >= wholeHeight - 2) {
//            alert('滚动到底部了！');
            if (isLoad) {
                isLoad = false;
                setTimeout($.wyui.page.getByPage("scroll"), 1000);

            }

            //这里写动态加载的逻辑，比如Ajax请求后端返回下一个页面的内容
        }

    }

    divscroll.onscroll = divScroll;
</script>
</body>
</html>